<!-- 组件说明 -->
<template>
  <div class='goods-item' @click="itemClick">
    <img :src="goodsItem.img" alt="" @load="imgLoad">
    <div class="goods-info">
      <p>{{goodsItem.name}}</p>
      <p >
        <span class="price">44</span>
        <span class="collect">55</span>
      </p>
     
    </div>
  </div>
</template>

<script>
  //import x from ''
  export default {
    name: 'GoodsListItem',
    components: {

    },
    props: {
      goodsItem: {
        type: Object,
        default() {
          return {}
        }
      }
    },
    data () {
      return {

      };
    },
    computed: {

    },
    methods: {
      imgLoad() {
        //往事件总线发射数据
        this.$bus.$emit('imageLoad')
      },

      itemClick() {
        this.$router.push('/detail/' + this.goodsItem.id )
      }
    },
  }
</script>

<style  scoped>
  .goods-item {
    width: 48%;
    padding-bottom: 40px;
    position: relative;
  }
  .goods-item img {
    width: 100%;
    border-radius: 5px;
  }

  .goods-info {
    font-size: 12px;
    position: absolute;
    bottom: 5px;
    left: 0px;
    right: 0px;
    overflow: hidden;
    text-align: center;

  }

  .goods-info p{
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 3px;
  }
</style>